package com.example.factory;

import com.example.factory.shape.Shape;
import com.example.factory.shape.ShapeFactory;
import org.junit.jupiter.api.Test;

/**
 * @Description TODO
 * @Date 2021/10/20 9:02
 * @Author ZhangJi
 * @Version 1.0
 */
public class FactoryPatternTest {

  @Test
  public void factoryPatternTest(){
    ShapeFactory shapeFactory = new ShapeFactory();
    // 创建三种形状
    shapeFactory.getShapeByType("Rectangle").draw();
    Shape circle = shapeFactory.getShapeByType("Circle");
    Shape square = shapeFactory.getShapeByType("Square");

    circle.draw();
    square.draw();
  }

}
